home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / PASANS.ZIP / CH15_1B.PAS < prev    next >
Pascal/Delphi Source File  |  1991-02-04  |  2KB  |  79 lines

  1.                        (* Chapter 16 - Programming exercise 1 *)
  2. program Employee;
  3.  
  4. {$R+}
  5.  
  6. uses Person, Supervsr;
  7.  
  8. var staff : array[1..10] of ^Person_ID;
  9.     Sup   : ^Supervisor;
  10.     Prog  : ^Programmer;
  11.     Sec   : ^Secretary;
  12.     Con   : ^Consultant;
  13.     Index : integer;
  14.  
  15. begin
  16.  
  17.    for Index := 1 to 10 do
  18.       staff[Index]^.Init;
  19.  
  20.    WriteLn('XYZ Staff assignments.');
  21.    WriteLn;
  22.  
  23.    new(Sup);
  24.    staff[1] := Sup;
  25.    Sup^.Init('Big John', 5100, 'President');
  26.  
  27.    new(Prog);
  28.    staff[2] := Prog;
  29.    Prog^.Init('Joe Hacker', 3500, 'Pascal');
  30.  
  31.    new(Prog);
  32.    staff[3] := Prog;
  33.    Prog^.Init('OOP Wizard', 7700, 'OOP Pascal');
  34.  
  35.    new(Sec);
  36.    staff[4] := Sec;
  37.    Sec^.Init('Tillie Typer', 2200, True, 85);
  38.  
  39.    new(Sup);
  40.    staff[5] := Sup;
  41.    Sup^.Init('Tom Talker', 5430,'Sales Manager');
  42.  
  43.    new(Prog);
  44.    staff[6] := Prog;
  45.    Prog^.Init('Dave Debug', 5725, 'Assembly Language');
  46.  
  47.    new(Con);
  48.    staff[7] := Con;
  49.    Con^.Init('Fred Fixer', 2150, 'Office copier');
  50.  
  51.    new(Con);
  52.    staff[8] := Con;
  53.    Con^.Init('Willy Waters', 1100, 'Water cooler');
  54.  
  55.    for Index := 1 to 8 do
  56.       staff[Index]^.Display;
  57.  
  58. end.
  59.  
  60.  
  61.  
  62.  
  63. (* Result of execution
  64.  
  65. XYZ Staff assignments.
  66.  
  67. Big John is the president and makes $5100 per month.
  68. Joe Hacker specializes in Pascal and makes $3500 per month.
  69. OOP Wizard specializes in OOP Pascal and makes $7700 per month.
  70. Tillie TYper can type 85 words per minute.
  71. Tom Talker is the Sales Manager and makes $5430 per month.
  72. Dave Debug specializes in Assembly Language and makes $5725 per month.
  73. Fred Fixer specializes in Office copier and his fee is $2150 per cons
  74. ulting month.
  75. Willy Waters specializes in Water cooler and his fee is $1100 per con
  76. sulting month.
  77.  
  78. *)
  79.